/**
 * Created by lenovo on 2018-07-19.
 */
/*底部的样式----这里用到的是为每个div绑定click事件，怎样用事件委托呢*/
//    var divArr = $(".footer>div");
//    var divLen = $(divArr).length;
//    for(var i=0;i<divLen;i++){
//        $(divArr[i]).click(function () {
//            var img = $(this).children().children();
//            for(var j=0;j<divLen;j++) {
//                var otherImgArr = $(divArr[j]).children().children();
//                console.log($(otherImgArr).attr("data-img"));
//                $(otherImgArr).attr("src", $(otherImgArr).attr("data-img"));
//            }
//            $(img).attr("src",$(img).attr("alt"));
//        });
//    }
/*主页底部颜色变化，事件委托实现*/
$(".footer").on("click","img", function (e) {
    var event = e || window.event;
    var target = $(event.target);
    var src = target.attr("src");
    var href = target.parent().attr("_href");
    var arr = target.parent().parent().siblings();
    var len = $(arr).length;
    for(var i=0;i<len;i++){
        var curr = $(arr[i]).children().children();
        $(curr).attr("src",$(curr).attr("data-img"));
    }
    target.attr("src",target.attr("alt"));
    $(".hys-tab-item>iframe").attr("src",href);
})

